<cfcomponent extends="base">

<cffunction access="public" name="GET">
<cfif url.type eq "poc">
<cfquery datasource="#session.dsn#" name="get_poc">
select * from poc_detail where poc_id = #url.id# 
</cfquery>
<cfquery datasource="#session.dsn#" name="files">
select * from resume_directory where poc_id = #get_poc.poc_id# 
</cfquery>
<form action="" method="post" enctype="multipart/form-data">


<table>
<tr>
<td align="right"><span class="Form_Item_Label">To:</span></td>
<td align="left"><span class="Form_Item_Field"><input type='text' name='to_' class=''  value="" size="50" /></span></td>
</tr>
<tr>
<td align="right"><span class="Form_Item_Label">From:</span></td>
<td align="left"><span class="Form_Item_Field"><input type='text' name='from' class=''  value="<cfoutput>#session.email#</cfoutput>" size="50"/></span></td>
</tr>
<tr>
<td align="right"><span class="Form_Item_Label">Subject:</span></td>
<td align="left"><span class="Form_Item_Field"><input type='text' name='subject' class=''  value="" size="50"/></span></td>
</tr>
<tr>
<td align="right" valign="top"><span class="Form_Item_Label">Body:</span></td>
<td align="left"><span class="Form_Item_Field"><textarea id="body"name="body" cols="50" rows="5"><cfoutput>#get_poc.email#</cfoutput>
</textarea></span></td>
</tr>
<tr>
<td align="right" valign="top"><span class="Form_Item_Label">Attachments:</span></td>
<td align="left"><span class="Form_Item_Field"><cfloop query="files"><a href="<cfoutput>#files.resume_location#</cfoutput>" target="_blank"><cfoutput>#files.resume_title#</cfoutput></a>,</cfloop></span></td>
</tr>
<Tr><td><input type="submit" value="Send Email" class="button" /></td><td>&nbsp;</td></Tr>
</table>
<input type="hidden" name="poc_id" id="poc_id" value="<cfoutput>#get_poc.poc_id#</cfoutput>">
<input type="hidden" name="post_type" id="post_type" value="poc">
</form>
<cfelseif  url.type eq "report">



<cfinvoke component="data" method="get_report_list" returnvariable="report" id="#url.report_id#">
<form action="" method="post" enctype="multipart/form-data">
<table>
<tr>
<td align="right"><span class="Form_Item_Label">To:</span></td>
<td align="left"><span class="Form_Item_Field"><input type='text' name='to_' class=''  value="" size="50" /></span></td>
</tr>
<tr>
<td align="right"><span class="Form_Item_Label">From:</span></td>
<td align="left"><span class="Form_Item_Field"><input type='text' name='from' class=''  value="<cfoutput>#session.email#</cfoutput>" size="50"/></span></td>
</tr>
<tr>
<td align="right"><span class="Form_Item_Label">Subject:</span></td>
<td align="left"><span class="Form_Item_Field"><input type='text' name='subject' class=''  value="<cfoutput>#report.report_description#</cfoutput>" size="50"/></span></td>
</tr>
<tr>
<td align="right" valign="top"><span class="Form_Item_Label">Body:</span></td>
<td align="left"><span class="Form_Item_Field"><textarea id="body"name="body" cols="50" rows="5"></textarea></span></td>
</tr>
<tr>
<td align="right" valign="top"><span class="Form_Item_Label">Attachments:</span></td>
<td align="left"><span class="Form_Item_Field">
<cfloop list="#report.poc_id#" index="i">
<cfquery datasource="#session.dsn#" name="get_poc">
select * from poc_detail where poc_id = #i# 
</cfquery>
<cfquery datasource="#session.dsn#" name="files">
select * from resume_directory where poc_id = <cfif get_poc.poc_id eq "">0<cfelse>#get_poc.poc_id# </cfif>
</cfquery>
<a href="<cfoutput>#files.resume_location#</cfoutput>" target="_blank"><cfif files.resume_title eq ""><cfelse><cfoutput>#files.resume_title# - #get_poc.first_name# #get_poc.last_name#</cfoutput></a>, </cfif></cfloop></span></td>
</tr>
<Tr><td><input type="submit" value="Send Email" class="button" /></td><td>&nbsp;</td></Tr>
</table>
<input type="hidden" name="report_id" id="report_id" value="<cfoutput>#url.report_id#</cfoutput>">
<input type="hidden" name="post_type" id="post_type" value="report">
</form>


<cfelse>



<cfinvoke component="data" method="get_current_report" returnvariable="report" >
<form action="" method="post" enctype="multipart/form-data">
<table>
<tr>
<td align="right"><span class="Form_Item_Label">To:</span></td>
<td align="left"><span class="Form_Item_Field"><input type='text' name='to_' class=''  value="" size="50" /></span></td>
</tr>
<tr>
<td align="right"><span class="Form_Item_Label">From:</span></td>
<td align="left"><span class="Form_Item_Field"><input type='text' name='from' class=''  value="<cfoutput>#session.email#</cfoutput>" size="50"/></span></td>
</tr>
<tr>
<td align="right"><span class="Form_Item_Label">Subject:</span></td>
<td align="left"><span class="Form_Item_Field"><input type='text' name='subject' class=''  value="" size="50"/></span></td>
</tr>
<tr>
<td align="right" valign="top"><span class="Form_Item_Label">Body:</span></td>
<td align="left"><span class="Form_Item_Field"><textarea id="body"name="body" cols="50" rows="5"></textarea></span></td>
</tr>
<tr>
<td align="right" valign="top"><span class="Form_Item_Label">Attachments:</span></td>
<td align="left"><span class="Form_Item_Field"><cfloop list="#report.poc_id#" index="i">
<cfquery datasource="#session.dsn#" name="get_poc">
select * from poc_detail where poc_id = #i# 
</cfquery>
<cfquery datasource="#session.dsn#" name="files">
select * from resume_directory where poc_id = #get_poc.poc_id# 
</cfquery>
<a href="<cfoutput>#files.resume_location#</cfoutput>" target="_blank"><cfif files.resume_title eq ""><cfelse><cfoutput>#files.resume_title# - #get_poc.first_name# #get_poc.last_name#</cfoutput></a>, </cfif></cfloop></span></td>
</tr>
<Tr><td><input type="submit" value="Send Email" class="button" /></td><td>&nbsp;</td></Tr>
</table>
<input type="hidden" name="report_id" id="report_id" value="current">
<input type="hidden" name="post_type" id="post_type" value="current">
</form>


</cfif>
</cffunction>

<cffunction access="public" name="POST">
<cfif post_type eq "poc">
<cfquery datasource="#session.dsn#" name="get_poc">
select * from poc_detail where poc_id = #form.poc_id# 
</cfquery>
<cfquery datasource="#session.dsn#" name="files">
select * from resume_directory where poc_id = #get_poc.poc_id# 
</cfquery>

 <cfif form.to_ is not "" >
      <cfmail type="html" to = "#form.to_#" from = "#session.email#" subject = "#form.subject#"  server="mail.bfrick22.com" username="cf_mail@bfrick22.com" password="1111" failto="bfrick22@hotmail.com">
            This message was sent by NIPD System:
            = = = = = = = = = = = = = = = = = = = = = = = = = = =
            #form.body#
			
		<cfloop from="1" to="#files.recordcount#" index="i">
			<!---<cfmailparam file="http://bfrick22.com/repository/#files.resume_title[i]#"  >--->
			<cfoutput><a href="http://bfrick22.com/repository/#files.resume_title[i]#" target="_blank">#files.resume_title[i]#</a>, </cfoutput>
		</cfloop>
		
      </cfmail>   

   </cfif>
   <script>self.close();</script>
<cfelseif post_type eq "report">
<cfinvoke component="data" method="get_report_list" returnvariable="report" id="#form.report_id#">

 <cfif form.to_ is not "" >
      <cfmail type="html" to = "#form.to_#" from = "#session.email#" subject = "#form.subject#"  server="mail.bfrick22.com" username="cf_mail@bfrick22.com" password="1111" failto="bfrick22@hotmail.com">
            This message was sent by NIPD System:
            = = = = = = = = = = = = = = = = = = = = = = = = = = =
            #form.body#<br>
<cfloop from="1" to="#listlen(report.poc_id)#" index="x">
<cfquery datasource="#session.dsn#" name="get_poc">
select * from poc_detail where poc_id = #listgetat(report.poc_id,x,",")# 
</cfquery>
<cfquery datasource="#session.dsn#" name="files">
select * from resume_directory where poc_id = <cfif get_poc.poc_id eq "">0<cfelse>#get_poc.poc_id# </cfif>
</cfquery>
		<cfloop from="1" to="#files.recordcount#" index="i">
<!---			<cfmailparam file="http://bfrick22.com/repository/#files.resume_title[i]#"  >--->
			<cfoutput><a href="http://bfrick22.com/repository/#files.resume_title[i]#" target="_blank">#files.resume_title[i]#</a>, </cfoutput>
		</cfloop>
</cfloop>
      </cfmail>   

   </cfif>
   <script>self.close();</script> 
   
<cfelse>
<cfinvoke component="data" method="get_current_report" returnvariable="report" >

 <cfif form.to_ is not "" >
      <cfmail type="html" to = "#form.to_#" from = "#session.email#" subject = "#form.subject#"  server="mail.bfrick22.com" username="cf_mail@bfrick22.com" password="1111" failto="bfrick22@hotmail.com">
            This message was sent by NIPD System:
            = = = = = = = = = = = = = = = = = = = = = = = = = = =
            #form.body#
<cfloop from="1" to="#listlen(report.poc_id)#" index="x">
<cfquery datasource="#session.dsn#" name="get_poc">
select * from poc_detail where poc_id = #listgetat(report.poc_id,x,",")# 
</cfquery>
<cfquery datasource="#session.dsn#" name="files">
select * from resume_directory where poc_id = #get_poc.poc_id# 
</cfquery>
		<cfloop from="1" to="#files.recordcount#" index="i">
<!---			<cfmailparam file="http://bfrick22.com/repository/#files.resume_title[i]#"  >--->
<cfoutput><a href="http://bfrick22.com/repository/#files.resume_title[i]#" target="_blank">#files.resume_title[i]#</a>, </cfoutput>
		</cfloop>
</cfloop>
      </cfmail>   

   </cfif>
   <script>self.close();</script> 
   

</cfif>   
</cffunction>

</cfcomponent>